import data
read_as_df <- function(path, col_name) {
df <- read.csv(path, header = FALSE) %>% data.frame()
names(df) <- col_name
return(df)
}
points <- read.csv("data/cpp_astar_path.csv")
points_pick_reg <- read.csv("data/cpp_reg_simplified.csv")
three_d_map <- read.csv("data/status.csv")
head(points)
## x y z
## 1 1 1 1
## 2 2 2 2
## 3 3 3 3
## 4 4 4 4
## 5 5 5 5
## 6 6 6 6
points_pick_reg
## x y z
## 1 1 1 1
## 2 35 35 35
## 3 39 38 39
## 4 43 38 43
## 5 47 38 47
## 6 50 39 50
## 7 51 50 61
## 8 32 68 80
## 9 29 69 83
## 10 21 76 91
## 11 17 77 95
## 12 10 80 98
plot using plotly package
print_points <- function(input_df){
return (input_df %>%
plot_ly() %>%
add_paths(x = ~x, y = ~y, z = ~z))
}
print_points(points)
print_points(points_pick_reg)
visiualization with searched areas and blocked areas.
map_block <- three_d_map %>% filter(status == 1)
map_searched <- three_d_map %>% filter(status == 2)
p <- plot_ly() %>%
# draw blocked
add_trace(type="scatter3d", mode = 'markers', ids = 'blocks',
x = map_block$x, y = map_block$y, z = map_block$z,
marker = list(color = c('#696969'),
symbol = 'square', size = '2', opacity = '0.5')) %>%
# draw searched
add_trace(type="scatter3d", mode = 'markers', ids = 'blocks',
x = map_searched$x, y = map_searched$y, z = map_searched$z,
marker = list(color = c('#66ccff'),
symbol = 'square', size = '0.2', opacity = '1')) %>%
add_paths(x = points_pick_reg$x, y = points_pick_reg$y, z = points_pick_reg$z,
line = list(width = 10, color = '#FF0000'))
p